import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import Ranking from '../views/Ranking.vue'
import HotSong from '../views/HotSong.vue'
import Search from '../views/Search.vue'
import ListDetail from '../views/ListDetail.vue'
import PlayPage from '../views/PlayPage.vue'
import LeaderboardDetails from '../views/LeaderboardDetails.vue'
import SearchList from '../views/SearchList.vue'
const cors = require('koa2-cors');
// Vue.use();
Vue.use(VueRouter,cors())

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home,
    meta:{
      showFixed:true
    },
  },
  {
    path: '/ranking',
    name: 'Ranking',
    component: Ranking,
    meta:{
      showFixed:true
    }
  },
  {
    path: '/hot',
    name: 'HotSong',
    component: HotSong,
    meta:{
      showFixed:true
    }
  },
  {
    path: '/search',
    name: 'Search',
    component: Search,
    meta:{
      showFixed:true
    }
  },
  {
    path: '/listdetail',
    name: 'ListDetail',
    component: ListDetail
  },
  {
    path: '/playpage',
    name: 'PlayPage',
    component: PlayPage,
    beforeEnter: (to, from, next) => {
      window.localStorage.setItem("lyricFrom",from.fullPath)
      next()
    }
  },
  {
    path: '/leaderboarddetails',
    name: 'LeaderboardDetails',
    component: LeaderboardDetails,
  },
  {
    path: '/searchlist',
    name: 'SearchList',
    component: SearchList,
  },
]


const router = new VueRouter({
  routes
})
export default router
